#-*- codeing = utf-8 -*-
#@Time : 2020/11/25 22:04
#@Author : 阳某
#@File : 18.json操作，拷贝.py
#@Software : PyCharm

team1 = [{
    'name':'11',
    'age':'18'
},   {
    'name':'1111',
    'age':'15'
}]
team2 = team1   #team2的改变也会影响team1，因为他们指向同一个数据对象
print(team1==team2)
print(id(team1))
print(id(team2))

print(team1)
print(team2)
team2[0]['name'] = '22'
print(team2)
print('**********************')
print(team1)

team3 = []
for a in team1:
    team3.append(a)

print(team1 == team3)
print(team1)
team3[0]['name'] ='33'
print('..................................')
print(team3)
print(team1)

team4 = []
for a in team1:
    # print(a)
    team4.append({'name':a['name'],'age':a['age']})

print(team1 == team4)
team4[0]['name'] ='44'
print(team4)
print(team1)

print('55555555555555555555555555')
import json
# json深拷贝
print(type(json.dumps(team1)))
print(type(json.loads(json.dumps(team1))))
team5 = json.loads(json.dumps(team1))
print(team1 == team4)
team5[0]['name'] ='55'
print(team5)
print(team1)